import { Component } from '@angular/core';
import { Router } from '@angular/router';
// 引入Parse第三方库
import * as Parse from "parse"
(Parse as any).serverURL = "http://metapunk.cn:9999/parse"
Parse.initialize("dev")

@Component({
  selector: 'app-page-register',
  templateUrl: './page-register.component.html',
  styleUrls: ['./page-register.component.scss']
})
export class PageRegisterComponent {
  goLogin(){
    this.router.navigate(["../intelligent-shopping/login"])
  }
  constructor(private router:Router){}
  username:string = ""
  password:string = ""
 repassword:string = ""
  register(){
    if(this.password!=this.repassword)
    {
      alert('两次输入密码不一致')
      return
    }
    console.log(this.username,this.password)
    //创建操作
    let User = Parse.Object.extend("_User");
    let xiaoming = new User;
    let userJson = {username:this.username,password:this.password}
xiaoming.set(userJson)
xiaoming.save();
  }
}
